package core;

import branch.Branch;
import gitobject.Commit;
import gitobject.Tree;
import index.Index;
//import repository.Repository;

//import java.io.*;
//import java.util.Arrays;
import java.util.Date;
import java.util.LinkedList;
//import java.util.List;

public class JitCommit {
<<<<<<< HEAD
    public static String commit(String message) throws Exception { //rikka: void改成String了
=======
    public static String commit(String message) throws Exception {
>>>>>>> 86693ae5299cdac0871be1578566d765f59b5e42
        LinkedList<String[]> tempList = Index.indexList;
        Tree tree = new Tree(tempList);//对index中的所有文件建立一个tree
        System.out.println("tree " + tree.getKey());
        String author = "Zj " + new Date().toString();
        String commiter = "Zj " + new Date().toString();

        Commit currentCommit = new Commit(tree,author,commiter,message);
        System.out.println("commit " + currentCommit.getKey());

        Branch.modifyBranch(currentCommit.getKey());

<<<<<<< HEAD
        String firstCommitName = currentCommit.getKey();//rikka: 加了这里
        return firstCommitName;  //rikka: 加了这里
=======
        String firstCommitName = currentCommit.getKey();
        return firstCommitName;//用于后期回滚
>>>>>>> 86693ae5299cdac0871be1578566d765f59b5e42
    }
}
